//定义仓库
import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
export const useCounterStore = defineStore('counter', () => {
    //参数1: user 相当于 vuex 模块化中的命名空间 namespaced:true
    // 定义仓库中的数据相当于state
    const count = ref(0);
    const addCount = () => {
        count.value++
    }

    const doubleCount = computed(() => {
        return count.value * 2
    })
    // 将仓库中的数据和方法抛出去
    return {
        count,
        addCount,
        doubleCount
    }
})
